package com.yituo.mjworld.core.utils;

/**
 * 载体类.
 */
public class Payload {
  /**
   * 签发主体
   */
  private String iss;
  /**
   * 所属的人
   */
  private String sub;
  /**
   * 接收对象
   */
  private String aud;
  /**
   * 过期时间
   */
  private long exp;
  /**
   * 颁发的时间
   */
  private long iat;
  /**
   * 用户ID
   */
  private String userId;
  /**
   * 角色类型
   */
  private String userType;

  public Payload() {
    // 给定一些默认值
    long currentTime = System.currentTimeMillis();
    this.iss = "xq";
    // 设置默认的过期时间
    if (Constant.IS_DEV) {
      this.exp = currentTime + 100 * 60 * 60 * 1000;
    } else {
      this.exp = currentTime + 1 * 60 * 60 * 1000;
    }
    // 设置默认的创建时间
    this.iat = currentTime;

  }

  public String getIss() {
    return iss;
  }

  public Payload setIss(String iss) {
    this.iss = iss;
    return this;
  }

  public String getSub() {
    return sub;
  }

  public Payload setSub(String sub) {
    this.sub = sub;
    return this;
  }

  public String getAud() {
    return aud;
  }

  public Payload setAud(String aud) {
    this.aud = aud;
    return this;
  }

  public long getExp() {
    return exp;
  }

  public Payload setExp(long exp) {
    this.exp = exp;
    return this;
  }

  public long getIat() {
    return iat;
  }

  public Payload setIat(long iat) {
    this.iat = iat;
    return this;
  }

  public String getUserId() {
    return userId;
  }

  public Payload setUserId(String userId) {
    this.userId = userId;
    return this;
  }

  public String getUserType() {
    return userType;
  }

  public Payload setUserType(String userType) {
    this.userType = userType;
    return this;
  }

}
